﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Collections;
using System.Web.UI.WebControls;

namespace GPCSC.Web
{
    public class DataReturn
    {
        public DataReturn()
        { 
        
        }

        public DataSet ReturnData(Hashtable htable, string SqlName)
        {
            DataSet ds = new DataSet();
            ds = new SqlReadXml().ReaderDataSet(SqlName,htable);
            if (ds.Tables.Count > 0)
            {
                return ds;
            }
            else
            {
                return null;
            }
        }
        public ListItemCollection lc( DataSet ds,string textname,string valuename)
        {
            ListItemCollection lcs = new ListItemCollection();
            ListItem it = new ListItem();
            it.Text = "--请选择--";
            it.Value = "null";
            lcs.Add(it);
            if (ds.Tables.Count > 0)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach(DataRow dr  in ds.Tables[0].Rows)
                    {
                        ListItem iis = new ListItem();
                        iis.Text = dr[textname].ToString();
                        iis.Value = dr[valuename].ToString();
                        lcs.Add(iis);
                    }
                }
            }
            return lcs;
        }

    }
}